package br.com.naybee.framework.client.componente.gwt.web;

import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.SpanElement;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.Widget;

public class Span extends ComplexPanel implements HasClickHandlers {

	private SpanElement elementSpan = Document.get().createSpanElement();

	public Span() {
		this.setElement(elementSpan);
	}

	public void add(Widget w) {
		Element element = this.getElement();
		add(w, element);
	}

	public void setClassName(String classe) {
		this.elementSpan.setClassName(classe);
	}

	public String getClassName() {
		return this.elementSpan.getClassName();
	}

	public void setText(String texto) {
		this.elementSpan.setInnerText(texto);
	}

	public String getText() {
		return this.elementSpan.getInnerText();
	}

	public HandlerRegistration addClickHandler(ClickHandler handler) {
		return addDomHandler(handler, ClickEvent.getType());
	}
}
